                <h4 class="add_title"><b class="ico">{$lang.consignee_address}</b><p><a href="{url app=my_address}" target="_blank">{$lang.manage_address}</a></p></h4>
                <script type="text/javascript" src="{lib file=mlselection.js}" charset="utf-8"></script>
                <script type="text/javascript" src="{lib file=jquery.plugins/jquery.validate.js}" charset="utf-8"></script>
                <script type="text/javascript" src="{lib file=dialog/dialog.js}" id="dialog_js" charset="utf-8"></script>
                <script type="text/javascript" src="{lib file=jquery.ui/jquery.ui.js}" id="dialog_js" charset="utf-8"></script>
                <script type="text/javascript">
                var shippings = {$shippings};
                var addresses = {$addresses};
                var goods_amount = {$goods_info.amount};
                var goods_quantity = {$goods_info.quantity};
                $(function(){
                    regionInit("region");
                    $('#order_form').validate({
                        invalidHandler:function(e, validator){
                         var err_count = validator.numberOfInvalids();
                         var msg_tpl = '{$lang.order_have_error}';
                         var d = DialogManager.create('show_error');
                         d.setWidth(400);
                         d.setTitle(lang.error);
                         d.setContents('message', {type:'warning', text:$.format(msg_tpl, err_count)});
                         d.show('center');
                        },
                        errorPlacement: function(error, element){
                            var _message_box = $(element).parent().find('.field_message');
                            _message_box.find('.field_notice').hide();
                            _message_box.append(error);
                        },
                        success       : function(label){
                            label.addClass('validate_right').text('OK!');
                        },
                        rules : {
                            consignee : {
                                required : true
                            },
                            region_id : {
                                required : true,
                                min   : 1
                            },
                            address   : {
                                required : true
                            },
                            phone_tel : {
                                required : check_phone,
                                minlength:6,
                                checkTel : true
                            },
                            phone_mob : {
                                required : check_phone,
                                minlength:6,
                                digits : true
                            }
                        },
                        messages : {
                            consignee : {
                                required : '{$lang.consignee_required}'
                            },
                            region_id : {
                                required : '{$lang.region_required}',
                                min  : '{$lang.region_required}'
                            },
                            address   : {
                                required : '{$lang.address_required}'
                            },
                            phone_tel : {
                                required : '{$lang.phone_required}',
                                minlength: '{$lang.phone_tel_error}',
                                checkTel : '{$lang.phone_tel_error}'
                            },
                            phone_mob : {
                                required : '{$lang.phone_required}',
                                minlength: '{$lang.phone_mob_error}',
                                digits : '{$lang.phone_mob_error}'
                            }
                        }
                    });

                    $('ul[shipping_id]').each(function(){
                        var _shipping_fee = get_shipping_fee($(this).attr('shipping_id'));
                        $(this).find('[ectype="shipping_fee"]').html(price_format(_shipping_fee));
                    }).click(function(){
                        $(this).find('input[name="shipping_id"]').attr('checked', true);
                        set_order_amount($(this).attr('shipping_id'));
                    });

                    //select first
                    $($('ul[shipping_id]')[0]).click();
                });
                function set_order_amount(shipping_id){
                    var _shipping_fee = get_shipping_fee(shipping_id);
                    var _amount  = goods_amount + _shipping_fee;
                    $('#order_amount').html(price_format(_amount));
                }
                function get_shipping_fee(shipping_id){
                    var shipping_data = shippings[shipping_id];
                    var first_price   = Number(shipping_data['first_price']);
                    var step_price   = Number(shipping_data['step_price']);
                    return first_price + (goods_quantity - 1) * step_price;
                }
                function check_phone(){
                    return ($('#phone_tel').val() == '' && $('#phone_mob').val() == '');
                }
                function hide_error(){
                    $('#region').find('.error').hide();
                }
                </script>
                <!--{if $my_address}-->
                <script type="text/javascript">
                //<![CDATA[
                $(function(){
                    //$("input[name='address_options']").click(set_address);
                    $('.address_item').click(function(){
                        $(this).find("input[name='address_options']").attr('checked', true);
                        $('.address_item').removeClass('selected_address');
                        $(this).addClass('selected_address');
                        set_address();
                    });
                    //init
                    set_address();
                });
                function set_address(){
                    var addr_id = $("input[name='address_options']:checked").val();
                    if(addr_id == 0)
                    {
                        $('#consignee').val("");
                        $('#region_name').val("");
                        $('#region_id').val("");
                        $('#region select').show();
                        $("#edit_region_button").hide();
                        $('#region_name_span').hide();

                        $('#address').val("");
                        $('#zipcode').val("");
                        $('#phone_tel').val("");
                        $('#phone_mob').val("");

                        $('#address_form').show();
                    }
                    else
                    {
                        $('#address_form').hide();
                        fill_address_form(addr_id);
                    }
                }
                function fill_address_form(addr_id){
                    var addr_data = addresses[addr_id];
                    for(k in addr_data){
                        switch(k){
                            case 'consignee':
                            case 'address':
                            case 'zipcode':
                            case 'email':
                            case 'phone_tel':
                            case 'phone_mob':
                            case 'region_id':
                                $("input[name='" + k + "']").val(addr_data[k]);
                            break;
                            case 'region_name':
                                $("input[name='" + k + "']").val(addr_data[k]);
                                $('#region select').hide();
                                $('#region_name_span').text(addr_data[k]).show();
                                $("#edit_region_button").show();
                            break;
                        }
                    }
                }
                //]]>
                </script>
                <!--{foreach from=$my_address item=address name=address_select}-->
                <ul class="receive_add address_item{if $smarty.foreach.address_select.iteration == 1} selected_address{/if}">
                    <li class="radio"><input id="address_{$address.addr_id}" type="radio"{if $smarty.foreach.address_select.iteration == 1} checked="true"{/if} name="address_options" value="{$address.addr_id}" /></li>
                    <li class="particular">{$address.region_name|escape}&nbsp;&nbsp;{$address.address|escape}</li>
                    <li class="name">{$lang.consignee}: {$address.consignee|escape}</li>
                    <li class="mobile"><!--{if $address.phone_mob}-->{$address.phone_mob}<!--{else}-->{$address.phone_tel}<!--{/if}--></li>
                </ul>
                <!--{/foreach}-->
                <ul class="new_receive_add address_item">
                    <li class="radio"><input type="radio" name="address_options" id="use_new_address" value="0" /></li>
                    <li class="particular">{$lang.use_new_address}</li>
                </ul>
                <!--{/if}-->

                <ul class="fill_in_content" id="address_form">
                    <li>
                        <p class="title">{$lang.consignee}</p>
                        <p class="fill_in"><input type="text" name="consignee" id="consignee" class="text1" /><span class="field_message explain"><span class="field_notice">{$lang.consignee_desc}</span></span></p>
                    </li>
                    <li>
                        <p class="title">{$lang.region}</p>
                        <p class="fill_in">
                            <div id="region">
                                <span style="display:none;" id="region_name_span"></span>
                                <input id="edit_region_button" type="button" class="edit_region" value="{$lang.edit}" style="display:none;" />
                                <select onchange="hide_error();">
                                    <option value="0">{$lang.select_pls}</option>
                                    {html_options options=$regions}
                                </select>
                                <input type="hidden" class="mls_id" name="region_id" id="region_id"/><input type="hidden" name="region_name" class="mls_names" id="region_name"/>
                                <b style="font-weight:normal;" class="field_message explain"><span class="field_notice">{$lang.region_desc}</span></b>
                            </div>
                        </p>
                    </li>
                    <li>
                        <p class="title">{$lang.address}</p>
                        <p class="fill_in"><input type="text" name="address" id="address" class="text1 width1" /><span class="field_message explain"><span class="field_notice">{$lang.address_desc}</span></span></p>
                    </li>
                    <li>
                        <p class="title">{$lang.zipcode}</p>
                        <p class="fill_in"><input type="text" name="zipcode" id="zipcode" class="text1" /><span class="field_message explain"><span class="field_notice">{$lang.zipcode_desc}</span></span></p>
                    </li>
                    <li>
                        <p class="title">{$lang.phone_tel}</p>
                        <p class="fill_in"><input type="text" name="phone_tel" id="phone_tel" class="text1" /><span class="field_message explain"><span class="field_notice">{$lang.phone_tel_desc}</span></span></p>
                    </li>
                    <li>
                        <p class="title">{$lang.phone_mob}</p>
                        <p class="fill_in"><input type="text" id="phone_mob" name="phone_mob" class="text1" /><span class="field_message explain"><span class="field_notice">{$lang.phone_mob_desc}</span></span></p>
                    </li>
                    <li>
                        <p class="title">&nbsp;</p>
                        <p class="fill_in">
                            <label>
                                <input type="checkbox" value="1" id="save_address" name="save_address">&nbsp;{$lang.save_address}
                                <span class="explain">&nbsp;(&nbsp;{$lang.save_address_desc}&nbsp;)&nbsp;</span>
                            </label>
                        </p>
                    </li>
                </ul>

                <h4 class="add_title"><b class="ico">{$lang.select_shipping}</b></h4>
                <div class="fashion_list">
                    <!--{foreach from=$shipping_methods item=shipping_method name=shipping_select}-->
                    <ul class="receive_add" shipping_id="{$shipping_method.shipping_id}">
                        <li class="radio"><input type="radio" name="shipping_id" value="{$shipping_method.shipping_id}" /></li>
                        <li class="fashion">{$shipping_method.shipping_name|escape}</li>
                        <li class="pay">{$lang.shipping_fee}:&nbsp;<span class="money" ectype="shipping_fee">&yen; 0.00</span></li>
                        <li class="explain">{$shipping_method.shipping_desc|escape}</li>
                    </ul>
                    <!--{/foreach}-->
                </div>